﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlHistoryDailyRestore.ascx.cs"
    Inherits="UserControl_ControlHistoryDailyRestore" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>

<script type="text/javascript">
    function pageLoad() {

        var currentDate = new Date();
        var day = currentDate.getDate(); 	// range 1-31
        var month = currentDate.getMonth() + 1; // range 1-12
        var year = currentDate.getFullYear();
        var max;
        if (month <= 7) {
            if (month == 2) {
                // check for leap years for Febuary
                var isLeap = new Date(year, 1, 29).getDate() == 29;
                max = 28 + (isLeap ? 1 : 0);
            } else {
                max = (month & 1) ? 31 : 30;
            }
        } else {
            max = (month & 1) ? 30 : 31;
        }

        var starDateNow = '01' + "/" + month + "/" + year;
        var endDateNow = max + "/" + month + "/" + year;
		        
        //Ngày
        $(function() {
            $("#<%= txtFromDate.ClientID %>").datePicker(
	                {
	                    clickInput: true,
	                    startDate: starDateNow
	                }
	                );
        });

        $("#<%= txtFromDate.ClientID %>").bind(
		            'dpClosed', function(e, selectedDates) {
		                var d = selectedDates[0];
		                if (d) {
		                    d = new Date(d);
		                    $("#<%= txtToDate.ClientID %>").dpSetStartDate(d.addDays(0).asString());
		                }
		            }
	                    );

        $(function() {
            $("#<%= txtToDate.ClientID %>").datePicker(
	                {
	                    clickInput: true,
	                    endDate: endDateNow
	                }
	                );
        });

        $("#<%= txtToDate.ClientID %>").bind(
		           'dpClosed', function(e, selectedDates) {
		               var d = selectedDates[0];
		               if (d) {
		                   d = new Date(d);
		                   $("#<%= txtFromDate.ClientID %>").dpSetEndDate(d.addDays(0).asString());
		               }
		           }
	            );

        $("#<%= imgBtnAdd.ClientID %>").click(function() {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }        
    }
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="direct_container_right_titletop">
            Phục hồi file
        </div>
        <hr />
        <!-- Button chuc nang-->
        <div class="direct_container_main">
             <table>
                        <tr>
                            <td>Nhà phân phối</td>
                            <td>
                                <asp:DropDownList ID="drlDistributor" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td>
                                  <asp:ImageButton ID="imgBtnAdd" onclick="imgBtnAdd_Click" CausesValidation="false" ImageUrl="~/Images/Refresh.png" Width="32px" Height="32px" runat="server" />
                                    
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:CheckBox ID="chkFromDateToDate" runat="server" Text="Lọc theo ngày" OnCheckedChanged="chkFromDateToDate_CheckedChanged" AutoPostBack="true" />                                
                            </td>
                        </tr>
                        <tr>
                            <td>Từ ngày</td>
                            <td>  
                                <asp:TextBox ID="txtFromDate" runat="server" ></asp:TextBox> 
                                 <asp:RequiredFieldValidator ControlToValidate="txtFromDate" Display="None"  ID="RFVName" runat="server" ErrorMessage="Phải chọn ngày">
                                </asp:RequiredFieldValidator>
                                <cc1:ValidatorCalloutExtender TargetControlID="RFVName" ID="ValidatorCalloutExtender1" runat="server">
                                </cc1:ValidatorCalloutExtender>                                
                            </td>
                            <td>Đến Ngày</td>
                            <td>
                                <asp:TextBox ID="txtToDate" runat="server" ></asp:TextBox> 
                                 <asp:RequiredFieldValidator ControlToValidate="txtToDate" Display="None"  ID="RequiredFieldValidator1" runat="server" ErrorMessage="Phải chọn ngày">
                                </asp:RequiredFieldValidator>
                                <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator1" ID="ValidatorCalloutExtender2" runat="server">
                                </cc1:ValidatorCalloutExtender> 
                            </td>                            
                        </tr>
                    </table>       
                   
        </div>
        <!-- End Button chuc nang-->
        <!-- Content main-->
        <div class="direct_container_main">
            <div class="direct_container_form_right">
                <table border="0" width="100%">
                    <tr>
                        <td>
                            <asp:GridView ID="grvIntxd" runat="server" AutoGenerateColumns="False" PageSize="10"  
                                DataKeyNames="ID" EnableModelValidation="True" AllowPaging="True" 
                                onpageindexchanging="grvIntxd_PageIndexChanging1" onrowcommand="grvIntxd_RowCommand1"
                                >
                                <Columns>
                                    <asp:TemplateField HeaderText="Stt">
                                        <HeaderTemplate>
                                            STT
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="SiteCode" Visible="false">
                                        <HeaderTemplate>
                                            SiteCode
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                           <asp:Label ID="lblSitecode" runat="server" Text='<%# Eval("Sitecode")%>'></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Nhà phân phối">
                                        <HeaderTemplate>
                                            Nhà phân phối
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                           <%# Eval("Sitename")%>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Tiêu đề upload">
                                        <HeaderTemplate>
                                            Tiêu đề upload
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                          <%# Eval("Title")%>
                                           
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Tên file upload">
                                        <HeaderTemplate>
                                            Tên file upload
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                           <asp:Label ID="lblFileNameOrginaly" runat="server" Text='<%# Eval("FileNameOrginaly")%>'></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="Tên file trên hệ thống">
                                        <HeaderTemplate>
                                            Tên file trên hệ thống
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                          <asp:Label ID="lblFileNameDestination" runat="server" Text='<%# Eval("FileNameDestination")%>'></asp:Label>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="User xóa">
                                        <HeaderTemplate>
                                             User xóa
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <%# Eval("UserDeleted")%>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="Thời gian xóa">
                                        <HeaderTemplate>
                                             Thời gian xóa
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                          <%#String.Format("{0:dd/MM/yyyy HH:mm:ss}", Eval("DeleteDate"))%>                                                                                                                                     
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                        <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                    </asp:TemplateField>
                                     
                                    <asp:TemplateField>
                                         <ItemTemplate>
                                            <asp:ImageButton ID="imgBtnXoa" runat="server" CausesValidation="False"
                                            CommandName="Restore" Height="25px" Width="25px" ImageUrl="~/Images/Undo.png" ToolTip="Phục hồi" />
                                        </ItemTemplate>
                                        <ControlStyle BackColor="White" BorderColor="White" />
                                        <FooterStyle BackColor="White" BorderColor="White" />
                                        <HeaderStyle BackColor="White" BorderColor="White" />
                                        <ItemStyle BackColor="White" BorderColor="White" />
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter"
            Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" Width="601px">
            <ContentCollection>
                <dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server"
                    SupportsDisabledAttribute="True">
                </dxpc:PopupControlContentControl>
            </ContentCollection>
        </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>
